# alpha范围0.04-0.25
# beta范围0.04-0.60
# gamma范围0.04-0.60

import os
import numpy as np
import multiprocessing as mt

OPT = " --enable-ABM=true"

ER = " --network=ER --node=1000 --edge=2000"
WS = " --network=WS --node=1000 --k=4 --p=0.3"
BA = " --network=BA --node=1000 --m0=2 --m=2"

SIS = " --dynamic=SIS"
SIR = " --dynamic=SIR"
SEIR = " --dynamic=SEIR"

net = [ER, WS, BA]
dyn = [SIS, SIR, SEIR]


def runExp(alpha, beta):
    for gamma in np.arange(0.30, 0.61, 0.05):
        for n in net:
            for d in dyn:
                hahaha = "./build/Simulation" + OPT + n + d + " --alpha=" + "{:.2f}".format(alpha) + " --beta=" + "{:.2f}".format(
                    beta) + " --gamma=" + "{:.2f}".format(gamma) + " >> alpha=" + "{:.2f}".format(alpha) + "beta=" + "{:.2f}".format(beta) + ".csv"
                os.system(hahaha)


pool = mt.Pool(mt.cpu_count())

for alpha in np.arange(0.04, 0.16, 0.01):
    for beta in np.arange(0.10, 0.41, 0.02):
        pool.apply_async(func=runExp, args=(alpha,beta))
pool.close()
pool.join()
